<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>
MultiDimension
</title><link rel="stylesheet" type="text/css" href="../../../stylesheet.css" />
<script type="text/javascript" src="../../../animate.js"></script>
</head><body onload="openLink();">
<table class="content"><tr class="content"><td class="content"><div class="contentDiv">
<h1>MultiDimension</h1>
A tool to help an application execute multi-dimensional range queries.
 The algorithm used is database independent, the only requirement
 is that the engine supports a range index (for example b-tree).<br /><br />
<table class="block"><tr onclick="return allDetails()"><th colspan="2">Methods</th></tr>
<tr id="__0" onclick="return on(0)">
<td class="return">static MultiDimension</td><td class="method">
<a id="getInstance" href="#getInstance">getInstance</a>()
<div class="methodText">Get the singleton.</div>
</td></tr>
<tr onclick="return off(0)" class="detail" id="_0">
<td class="return">static MultiDimension</td><td>
<a id="getInstance" href="#getInstance">getInstance</a>()
<div class="methodText">Get the singleton.</div>
<div class="itemTitle">Returns:</div>
<div class="item">the singleton</div>
</td></tr>
<tr id="__1" onclick="return on(1)">
<td class="return">int</td><td class="method">
<a id="compare_long-_long-" href="#compare_long-_long-">compare</a>(long[] a, long[] b)
</td></tr>
<tr onclick="return off(1)" class="detail" id="_1">
<td class="return">int</td><td>
<a id="compare_long-_long-" href="#compare_long-_long-">compare</a>(long[] a, long[] b)
<div class="methodText"></div>
</td></tr>
<tr id="__2" onclick="return on(2)">
<td class="return">int</td><td class="method">
<a id="deinterleave_int_long_int" href="#deinterleave_int_long_int">deinterleave</a>(int dimensions, long scalar, int dim)
<div class="methodText">Gets one of the original multi-dimensional values from a scalar value.</div>
</td></tr>
<tr onclick="return off(2)" class="detail" id="_2">
<td class="return">int</td><td>
<a id="deinterleave_int_long_int" href="#deinterleave_int_long_int">deinterleave</a>(int dimensions, long scalar, int dim)
<div class="methodText">Gets one of the original multi-dimensional values from a scalar value.</div>
<div class="itemTitle">Parameters:</div>
<div class="item">dimensions - the number of dimensions</div>
<div class="item">scalar - the scalar value</div>
<div class="item">dim - the dimension of the returned value (starting from 0)</div>
<div class="itemTitle">Returns:</div>
<div class="item">the value</div>
</td></tr>
<tr id="__3" onclick="return on(3)">
<td class="return">String</td><td class="method">
<a id="generatePreparedQuery_String_String_String-" href="#generatePreparedQuery_String_String_String-">generatePreparedQuery</a>(String table, String scalarColumn, String[] columns)
<div class="methodText">Generates an optimized multi-dimensional range query.</div>
</td></tr>
<tr onclick="return off(3)" class="detail" id="_3">
<td class="return">String</td><td>
<a id="generatePreparedQuery_String_String_String-" href="#generatePreparedQuery_String_String_String-">generatePreparedQuery</a>(String table, String scalarColumn, String[] columns)
<div class="methodText">Generates an optimized multi-dimensional range query.
 The query contains parameters. It can only be used with the H2 database.</div>
<div class="itemTitle">Parameters:</div>
<div class="item">table - the table name</div>
<div class="item">columns - the list of columns</div>
<div class="item">scalarColumn - the column name of the computed scalar column</div>
<div class="itemTitle">Returns:</div>
<div class="item">the query</div>
</td></tr>
<tr id="__4" onclick="return on(4)">
<td class="return">int</td><td class="method">
<a id="getMaxValue_int" href="#getMaxValue_int">getMaxValue</a>(int dimensions)
<div class="methodText">Get the maximum value for the given dimension count.</div>
</td></tr>
<tr onclick="return off(4)" class="detail" id="_4">
<td class="return">int</td><td>
<a id="getMaxValue_int" href="#getMaxValue_int">getMaxValue</a>(int dimensions)
<div class="methodText">Get the maximum value for the given dimension count. For two dimensions,
 each value must contain at most 32 bit, for 3: 21 bit, 4: 16 bit, 5: 12
 bit, 6: 10 bit, 7: 9 bit, 8: 8 bit.</div>
<div class="itemTitle">Parameters:</div>
<div class="item">dimensions - the number of dimensions</div>
<div class="itemTitle">Returns:</div>
<div class="item">the maximum value</div>
</td></tr>
<tr id="__5" onclick="return on(5)">
<td class="return">ResultSet</td><td class="method">
<a id="getResult_PreparedStatement_int-_int-" href="#getResult_PreparedStatement_int-_int-">getResult</a>(PreparedStatement prep, int[] min, int[] max)
<div class="methodText">Executes a prepared query that was generated using generatePreparedQuery.</div>
</td></tr>
<tr onclick="return off(5)" class="detail" id="_5">
<td class="return">ResultSet</td><td>
<a id="getResult_PreparedStatement_int-_int-" href="#getResult_PreparedStatement_int-_int-">getResult</a>(PreparedStatement prep, int[] min, int[] max) throws SQLException
<div class="methodText">Executes a prepared query that was generated using generatePreparedQuery.</div>
<div class="itemTitle">Parameters:</div>
<div class="item">prep - the prepared statement</div>
<div class="item">min - the lower values</div>
<div class="item">max - the upper values</div>
<div class="itemTitle">Returns:</div>
<div class="item">the result set</div>
</td></tr>
<tr id="__6" onclick="return on(6)">
<td class="return">long</td><td class="method">
<a id="interleave_int..." href="#interleave_int...">interleave</a>(int... values)
<div class="methodText">Convert the multi-dimensional value into a one-dimensional (scalar) value.</div>
</td></tr>
<tr onclick="return off(6)" class="detail" id="_6">
<td class="return">long</td><td>
<a id="interleave_int..." href="#interleave_int...">interleave</a>(int... values)
<div class="methodText">Convert the multi-dimensional value into a one-dimensional (scalar) value.
 This is done by interleaving the bits of the values.
 Each values must be between 0 (including) and the maximum value
 for the given number of dimensions (getMaxValue, excluding).
 To normalize values to this range, use the normalize function.</div>
<div class="itemTitle">Parameters:</div>
<div class="item">values - the multi-dimensional value</div>
<div class="itemTitle">Returns:</div>
<div class="item">the scalar value</div>
</td></tr>
<tr id="__7" onclick="return on(7)">
<td class="return">long</td><td class="method">
<a id="interleave_int_int" href="#interleave_int_int">interleave</a>(int x, int y)
<div class="methodText">Convert the two-dimensional value into a one-dimensional (scalar) value.</div>
</td></tr>
<tr onclick="return off(7)" class="detail" id="_7">
<td class="return">long</td><td>
<a id="interleave_int_int" href="#interleave_int_int">interleave</a>(int x, int y)
<div class="methodText">Convert the two-dimensional value into a one-dimensional (scalar) value.
 This is done by interleaving the bits of the values.
 Each values must be between 0 (including) and the maximum value
 for the given number of dimensions (getMaxValue, excluding).
 To normalize values to this range, use the normalize function.</div>
<div class="itemTitle">Parameters:</div>
<div class="item">x - the value of the first dimension, normalized</div>
<div class="item">y - the value of the second dimension, normalized</div>
<div class="itemTitle">Returns:</div>
<div class="item">the scalar value</div>
</td></tr>
<tr id="__8" onclick="return on(8)">
<td class="return">int</td><td class="method">
<a id="normalize_int_double_double_double" href="#normalize_int_double_double_double">normalize</a>(int dimensions, double value, double min, double max)
<div class="methodText">Normalize a value so that it is between the minimum and maximum for the
 given number of dimensions.</div>
</td></tr>
<tr onclick="return off(8)" class="detail" id="_8">
<td class="return">int</td><td>
<a id="normalize_int_double_double_double" href="#normalize_int_double_double_double">normalize</a>(int dimensions, double value, double min, double max)
<div class="methodText">Normalize a value so that it is between the minimum and maximum for the
 given number of dimensions.</div>
<div class="itemTitle">Parameters:</div>
<div class="item">dimensions - the number of dimensions</div>
<div class="item">value - the value (must be in the range min..max)</div>
<div class="item">min - the minimum value</div>
<div class="item">max - the maximum value (must be larger than min)</div>
<div class="itemTitle">Returns:</div>
<div class="item">the normalized value in the range 0..getMaxValue(dimensions)</div>
</td></tr>
</table>
</div></td></tr></table></body></html>
